I think the scaling has to be applied to the scaling component of the transform. Also I'm not sure whether this is sufficient for flipping x and y. If'm I'm not mistaken this just flips the rows or the columns, not all. Unless its a stacked representation where each channels is represented by three rows.