External monitor moves windows when coming out of sleep (2012 rMBP)
It may be actually worth resetting the NVRAM and SMC (in that order) to see if this resolves your issues. Before doing so, unplug all external devices (including monitors, keyboard, etc).

Resetting NVRAM on your model MacBook Pro

Your Mac use Non-Volatile Random-Access Memory (NVRAM) to store a whole range of settings. Here’s how to reset this:


Shut down your Mac. Yes, a full shut down, not just logging out.
Press the power button and then press the commandoptionPR keys. You have to make sure you press these keys before the gray screen appears or it won’t work.
Hold those keys down until your Mac reboots again and you here the startup chime for the second time.
Let go of the keys and let your Mac reboot normally.


Note: When you log back in you may need to readjust some of your system preferences (e.g. speaker volume, screen resolution, startup disk selection, time zone information, etc).

Now proceed to reset the SMC.

Resetting the SMC on your model MacBook Pro

The System Management Controller (SMC) impacts a whole range of power management functions. Here's how to reset this:


Shut down your computer
Disconnect the MagSafe plug (power cable) from the computer
Remove the battery
Press the power button for 5 seconds and release
Put the battery back in
Reconnect the MagSafe cord (or power cable)
Turn your computer back on with the power button