We study the Bonnet problem for surfaces in 4-dimensional space forms, namely, to what extent a surface is determined by the metric and the mean curvature. Two isometric surfaces have the same mean curvature if there exists a parallel vector bundle isometry between their normal bundles that preserves the mean curvature vector fields. We deal with the structure of the moduli space of congruence classes of isometric surfaces with the same mean curvature and with properties inherited on a surface by this structure. The study of this problem led us to a new conformally invariant property, called isotropic isothermicity, that coincides with the usual concept of isothermicity for surfaces lying in totally umbilical hypersurfaces, and is related to lines of curvature and infinitesimal isometric deformations that preserve the mean curvature vector field. The class of isotropically isothermic surfaces includes the one of surfaces with a vertically harmonic Gauss lift and particularly the minimal surfaces, and overlaps with that of isothermic surfaces without containing the entire class. We show that if a simply connected surface is not proper Bonnet, which means that the moduli space is a finite set, then it admits either at most one, or exactly three Bonnet mates. For simply connected proper Bonnet surfaces, the moduli space is either 1-dimensional with at most two connected components diffeomorphic to the circle, or the 2-dimensional torus. We prove that simply connected Bonnet surfaces lying in totally geodesic hypersurfaces of the ambient space as surfaces of non-constant mean curvature always admit Bonnet mates that do not lie in any totally umbilical hypersurface. Such surfaces either admit exactly three Bonnet mates, or they are proper Bonnet with moduli space the torus. We show that isotropic isothermicity characterizes the proper Bonnet surfaces, and we provide relevant conditions for non-existence of Bonnet mates for compact surfaces. Moreover, we study compact surfaces that are locally proper Bonnet, and we prove that the existence of a uniform substructure on the local moduli spaces characterizes surfaces with a vertically harmonic Gauss lift that are neither minimal, nor superconformal. In particular, we show that the only compact, locally proper Bonnet surfaces with moduli space the torus, are those with nonvanishing parallel mean curvature vector field and positive genus.