Strain refraction in layered systems