Is a function null if its integrals over all rectangles vanish? In answering this question we have used the following result.
Lemma If a measurable function $f \colon \mathbb{R}^n \to \mathbb{R}$ is such that, for every (compact) rectangle $R$,
$$\int_R f(x)\,dx=0,$$
then $f=0$ almost everywhere.
I'm pretty much sure this is true, both for recalling having read about it somewhere and for its intuitive obviousness. However, when cooking up a proof, I couldn't avoid making use of the additional assumption $f \in L^1_{\rm{loc}}(\mathbb{R}^n)$. You can read my try here (I've explicitly mentioned the point in which the additional assumption is exploited).
How to dispense with that?
EDIT: Answer to comments
In comments below Didier, Julian and Byron noted that the condition $\int_R f(x)\,dx=0$ on the rectangle $R$ implicitly says $f \in L^1(R)$. And so, requiring it to hold for every compact rectangle implies $f \in L^1_{\rm{loc}}(\mathbb{R}^n)$. Of course you're right: to sum things up, my question is totally trivial!!! :-)
I guess it is now universally clear that I'm a novice (still a student, in fact).
Thank you very much for helping.

As noted by user8268 (and by Didier as I was writing this), your assumption implies that $f$ is locally integrable. The definition of integral for a signed function $f$ includes the condition that the integral of $f^+$ or of $f^-$ is finite.
Now, the Lebesgue differentiation theorem implies that if the integral of $f$ vanishes on all rectangles, then  $f=0$ almost everywhere. It is even enough that the integral vanishes on a family of rectangles of eccentricity between two bounds $M$ and $M^{-1}$.
