Emergent rotational dynamics and optical properties of metal–organic frameworks