Works on MacOS 10.15, other versions are not guaranteed.
./MonitorRotator
list the connected monitors.
./MonitorRotator 1 90
rotate the first external monitor to 90 deg configuration (on MacBook).
Note: on device without internal monitor (like Mac mini), the first external monitor might be the number 0