Added rotate-windows function, courtesy Magnar