Generalize `swap_nodes`

The `swap_nodes` function was not written to handle nodes from different
desktops. We need to be able to do that in order to move tiled windows
across monitors.