Imagemagick can handle batch processing, including rotation. Of course you'll need to know which image needs what amount (1-5 degrees) of rotation. You could either rotate all by 1 degree and then review for a further one degree, or check all at the start and put in folders of rotation amount.
-rotate degrees{<}{>} Apply Paeth image rotation (using shear
operations) to the image.
Use > to rotate the image only if its
width exceeds the height. < rotates
the image only if its width is less
than the height. For example, if you
specify -rotate "-90>" and the image
size is 480x640, the image is not
rotated. However, if the image is
640x480, it is rotated by -90 degrees.
If you use > or <, enclose it in
quotation marks to prevent it from
being misinterpreted as a file
redirection.