This is an amazing little toolset you've built. Thanks so much!
I'm running two external monitors with one at the standard rotation and one at 270°. When I use this swap, it swaps the location and windows in them (which is great), but the rotation of each is still wrong. I was trying to modify this to also swap the rotation and was running into some issues.
I was able to get the rotation of each monitor with CGDisplayRotation(firstDisplay) (and secondDisplay), but was having trouble when trying to find a way to set them. I would think that something from this would help if I converted it to Swift, but it seems that CGDisplayIOServicePort has been deprecated a number of years ago.
I was able to find some possible replacements here, but haven't been able to get them working with it,.
I was wondering if you had any thoughts on a good approach to also swap the rotations of the monitors as it would then solve all of my problems.