Magnetostructural coupling in RFeO3 (R = Nd, Tb, Eu and Gd)