When shutting down, how to re-open apps on their respective desktops? I work with 4 desktops, and every time I shutdown my machine, I tell it to re-open all windows on next boot.

The problem is, with the exception of iTerm2, they all re-open on the first desktop (probably because it's the one showing by default). 

I would like for every window to open in the desktop it was when I shut down the machine last time. This should be possible as iTerm2 always open on the desktop it was shutdown in. 

How do I do this?

The apps I'm having this issue are


Google Chrome: I have at least 1 window (with multiple tabs) on each desktop.
PHPStorm: I have 1 window on desktop number 3
If apps don't obey OS X's default windowing (which is to put apps back where they were before you logged out), then you can lock them to specific desktops which forces them to obey:

Right-click on the app in the Dock, then choose Options → This Desktop.