  We construct a general metric-tensor framework for treating inhomogenous
adiabatic deformations applied to crystalline insulators, by deriving an
effective time-dependent Schr\"odinger equation in the undistorted frame. The
response can be decomposed into "static" and "dynamic" terms that correspond,
respectively, to the amplitude and the velocity of the distortion. We then
focus on the dynamic contributon, which takes the form of a gauge field
entering the effective Hamiltonian, in the linear-response limit. We uncover an
intimate relation between the dynamic response to the rotational component of
the inhomogeneous deformation and the diamagnetic response to a corresponding
inhomogeneous magnetic field. We apply this formalism to the theory of
flexoelectric response, where we resolve a previous puzzle by showing that the
currents generated by the dynamic term, while real, generate no bound charges
even at surfaces, and so may be dropped from a practical theory of
flexoelectricity.
