Backward continued fractions, Hecke groups and invariant measures for transformations of the interval