There is no contradiction.
Work Step by Step
When light exits water into air, it bends away from the normal. This is shown in the problem's diagram, reproduced from Figure 28.27. As explained on page 528 and shown in Figure 28.28, this effect causes submerged objects to appear closer to the surface than they actually are. The corner of the immersed square appears to be closer to the surface, as expected. Another way to explain this is that the beam of light should not be confused with the edge of the square. In the right-hand-side illustration, light is not traveling along the edge of the square.