In "Calculus on Manifolds" by Michael Spivak, the author defined integrals over sets which are not rectangles as follows.
We have thus far dealt with the integrals of functions over rectangles. Integrals over other sets are easily reduced to this type. If $C\subset\mathbb{R}^n$, then characteristic function $\chi_ C$ of $C$ is defined by $$\chi_C(x) = \begin{cases} 0 & x\notin C, \\ 1 & x\in C. \end{cases}$$ If $C\subset A$ for some closed rectangle $A$ and $f:A\to\mathbb{R}$ is bounded, then $\int_C f$ is defined as $\int_A f\cdot\chi_C$, provided $f\cdot\chi_C$ is integrable. This certainly occurs (Problem 3-14) if $f$ and $\chi_C$ are integrable.
If we are given $f:C\to\mathbb{R}$, first of all, we need to extend $f$ to a function $g$ which is defined on $A$ to define $\int_C f$.
Since $\int_C f=\int_A g\cdot\chi_C$, the values of $g$ on $A-C$ is not important at all.
I wonder why the author didn't define $\int_C f$ like this:
Suppose $f:C\to\mathbb{R}$ is bounded.
If $C\subset A$ for some closed rectangle $A$, we define $g:A\to\mathbb{R}$ as $g(x) = f(x)$ if $x\in C$ and $g(x) = 0$ if $x\in A-C$.
We define $\int_C f=\int_A g$, provided $g$ is integrable.