Add the display_hdmi_rotate
configuration option to /boot/config.txt
to rotate the screen by 90, 180 or 270 degrees. After rotating, you will need to recalibrate the touchscreen.
The display_hdmi_rotate
configuration option is documented at https://www.raspberrypi.org/documentation/configuration/config-txt/video.md