Use align_image_stack program form hugin_tools package.
it's normally used to align photos for HDR image reation, but it does great job for what you need.
You can correct the X/Y offset with this command then:
align_image_stack -v -i -a prefix reference.png offset.png
Options used:
-v - verbose mode
-i - correct only X/Y offset (in relation to the first specified input image).
-a - save stabilized files to TIFFs in format prefix####.tif, where ##### is a number of the image staring form 0.
reference.png is the file you want to be the alignment source, the offset.png is the file you want to correct. The first file won't be affected, the second (and all the rest) will be matched to the first.
Then, you just need to convert the prefix0001.tif file to whatever you need, and you're done!