Ok, I think I have a working copy for you.
I downloaded the image you linked to and tested it on that image, and it is working for me.
First, download the attached file rotate_screen.rar and unzip it to rotate_screen.py
Place rotate_screen.py in your /home/pi/ folder on the RPi.
If you are running in startx mode, exit the GUI without rebooting, or to prompt.
You can also use terminal from startx, or remotely using putty
You should now be in terminal mode, or black screen with $ prompt.
Now locate your config.txt file located in /boot/
Type following command then hit enter
cd /boot
you should now be in the boot folder. Type ls and enter to confirm config.txt is listed.
Now make a backup copy of config.txt just in case something happens.
sudo cp config.txt /home/pi/config.bu
This places a copy in the home/pi folder and renames in config.bu.
To recover the file, from home/pi enter sudo cp config.bu /boot/config.txt
Go to /home/pi and use ls (LS) to make sure the file did copy.
now go back to boot folder. cd /boot
Now open up config.txt for editing by
sudo nano config.txt
The screen should fill up with the commands in the config.txt file.
cursor through and see if display_rotate=1 (or 0).
If it is not, at very bottom, on a new line, add display_rotate=0
I added this to my config.txt file:
# position screen based on display_rotate=0 for horizontal
# display_rotate=1 for vertical, top to right (90)
# display_rotate=2 for horizontal, flip (180)
# display=3 or vertical, top to left (270)
display_rotate=0
the lines with # in front are for info only and are ignored, you dont have to put those in if you dont want to.
Once you are happy with it, hit CTRL and x to exit nano. It will ask you if you want to save, type y and enter.
also if the display_rotate= is already in there, you dont have to do anything, just exit by ctrl + x
Right now, teh script can only handle 0 and 90, let me know if you need 270 and 180 and I can modify the script for that.
Now go back to /home/pi/ by cd /home/pi and enter
I set the script up to use pin 18 for the button, if you are using a different pin, open the rotate_screen.py using sudo nano rotate_screen.py
Find inpin=18 and change the 18 to whatever pin number you are tying the button to.
If you change anything you will need to save when you exit nano.
now test it to make sure it works.
sudo python rotate_screen.py
Press your rotate button and the screen should reboot in the opposite orientation.
If it works, enter sudo python rotate_screen.py to reboot with screen back to where its easier to work with.
If you Pi dont start in the home/pi folder, you will have to go to that folder first.
Now, if you are happy, lets make rotate_screen.py run automatically on boot up.
Go to /etc folder
cd /etc
use ls to see if rc.local is in the list.
If so we need to edit it by using sudo nano rc.local.
Scroll to very bottom of the file, and right above exit 0
enter this line:
python '/home/pi/rotate_screen.py' &
The & sign lets the script run in the background.
Here is what I have in my rc.local file:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
python '/home/pi/rotate_screen.py' &
exit 0
Yours may be different because your setup is doing a lot more than mine.
Just make sure your new line is above exit 0.
Exit nano and save it.
reboot your pi. (sudo reboot)
See what happens.
Disclaimer: There are no guarantees with using this script.
I highly suggest you make a backup copy of the sdcard before trying this.
If you have a current copy you can always start all over again from where you were before trying this.
Use extreme caution when connecting things to your GPIO header.
Incorrect connections can fry the Pi.
Power Pi down and remove power supply before attaching or removing anything from the GPIO header.
Always double check your wiring before powering back up.
Better safe than sorry.
If you see any bugs or this dont do what you want, let me know, i will try to fix them.