My experience with Window manipulation is that Main and Screen-number have a life of their own.
You may find my debug display option 90 useful if you have to debug this again
and the documentation on Screen visible mysteries.
https://forum.keyboardmaestro.com/t/window-squish-move-and-resize-win3