You can use Java to read the image into memory then redraw the image, but that will take some sweet math and skill to do.
Or you can cheat and save a bunch of pictures of the image each picture in a different position as you roatate it, then use Javascript or ajax to do an image swap. That's the cheap shortcut.