Open the config.txt file by using the following command in a terminal window:
sudo nano /boot/config.txt
Then add the line at the bottom:
This will rotate both the LCD and the touch coordinates back to the right rotation.
Don't use the documented display_rotate, it performs a performance expensive rotation of the screen and does not rotate the touch input.