added in modular affine transformation code for the G and R images