Understanding the magnetostructural transition in epitaxial FeRh films