Excuse me! Write a function to compare the intersection of rotated images (the sum of the difference or the sum of the difference of the squares between each point), and then iterate over the angles of rotation to find the one that corresponds to the minimum difference.
Although knowing matlab is probably a function that just tells you about rotation, it called something strange.