Why do rays of light change direction as they pass from air to a glass block?

GCSE