As I understand it, the Gauss-Bonnet theorem implies that if you take a bounded region of a 2D surface, and stretch it around in any smooth way, the total Gaussian curvature within that region doesn't change, because we haven't changed the boundary nor the Euler characteristic of the overall surface, nor have we modified the curvature anywhere outside that region.
Also, I've read that the Gauss-Bonnet theorem has generalizations to higher dimensions, but they are much less strict, so the total curvature is no longer invariant for a given Euler characteristic, essentially because the sectional curvature still varies like $1/r^2$ but the volume element is now cubic or higher.
So I'm wondering if there is any similar generalization for this notion of a deformation of a bounded region. For example, if you smoothly deform some region of a 3-sphere, can we conclude anything about the total scalar curvature of the deformation, such as that its sign must be positive because the region that it replaced was positive? Or perhaps something even more restrictive, relating to the value of the total curvature of that replaced region?
I'm especially curious how this would apply to a Lorentzian manifold because I'm interested in physics.
Thanks in advance for any insights!