I’ll go the easy way 
Sort out which command gives you the correct output. Make sure if the first doesn’t give you the desired result, always perform sudo xrandr -d :0 -o normal first, before running the next command.
- 90 deg
sudo xrandr -d :0 -o right - 180 deg
sudo xrandr -d :0 -o inverted - 270 deg
sudo xrandr -d :0 -o left - 0 deg
sudo xrandr -d :0 -o normal
then execute the following command:
-
sudo nano /etc/X11/Xsession.d/45custom_xrandr-settings
copy the command that gave the correct result from above test

-
Press CTRL+O, CTRL+X
-
sudo reboot
Screen should be in the correct layout.