The full answer you want is probably the general Stokes' theorem relating the integral of an n form dw over a region in n space, to the integral of its antiderivative (n-1) form w, over the boundary of the region. Note however that in this higher dimensional setting, it is not always true that every n form has an antiderivative, i.e. not every n form has the form dw. Whether or not this is true is related to the question raised above of when a path integral is independent of the path. E.g. in a convex region, the path integral of a one form w over a path joining two given points is independent of the path, iff the integral is zero over any closed path, iff dw = 0, iff w is itself equal to df for some function f, i.e. iff w has an antiderivative. More generally, an n form F equals dw for some (n-1) form w, iff the (n+1) form dF = 0, at least in a convex region. This is called the Poincare' lemma, and leads to a ("sheaf theoretic") proof of the deRham theorem. In general regions, the extent to which there can exist forms w with dw = 0 but which still have no global antiderivative, is a measure of the failure of the region to be convex, i.e. it measures the "homology" of the region. E.g. if we remove n points from the plane, the complementary open set will support an n dimensional vector space of 1-forms w satisfying dw = 0, but not of form df. Thus it has the same 1st homology group as the wedge of n circles.
By the way the example you found in a rectangle is entirely general in the sense that the general stokes theorem can be proved by patching together this result in a covering family of rectangles, in each of which it is reduced just to Fubini's theorem plus the usual one dimensional fundamental theorem of calculus. This is perhaps clearest in Lang's Analysis I, chapter XX, but also appears in Spivak's Calculus on Manifolds, and Guillemin and Pollack's Differential Topology. I think Lang does the best job of convincing you that it really only amounts to jazzing up the basic vertsion you ghave above, and hence should not be so scary complicated as it often looks. It may be useful as well to read up classical versions such as Green's theorem, Gauss' theorem, and classical Stokes theorem, but I would start with Green's theorem, i.e. stokes theorem in the plane.