Fix header guards
Extract find_scale_and_rotation into separate C/header files