Microscopic origin of entropy-driven polymorphism in hybrid organic-inorganic perovskite materials