You can go herehttp://cecs.wright.edu/~agoshtas/home.html to Arthur Goshtasby's site. This professor at Wright State University in Ohio is the guy wholiterally wrote the book on the subject. Two books actually. It's a complicated subject, so good luck.
If you have the Computer Vision System Toolbox, you can use that:
I would suggest you to use normalized cross-correlation first, to get a rough estimate of the position of your object, and then an affine transformation to get the perfect match of your template with the original image.