Let $D\subset\mathbb{Z}\times\mathbb{Z}$ such that $D$ is formed by the points bounded by a convex polytope. Let $f:D\to\mathbb{R}$ defined by $f(x,y)=ax+by+c$, where $a,b,c\in\mathbb{R}$ and $g:D\to\mathbb{N}$.

Conjecture: We can always find a subset $\tilde{D}\subset D$, such that $\tilde{D}$ is a subset of some unit square (or maybe some other small set?) and a function $\tilde{g}:\tilde{D}\to\mathbb{N}$ such that $$\sum_{(x_i,y_i)\in D}g(x_i,y_i)f(x_i,y_i)=\sum_{(x_i,y_i)\in \tilde{D}}\tilde{g}(x_i,y_i)f(x_i,y_i)$$

Is this true considering $D\subset\mathbb{Z}^n$ and $\tilde{D}$ a subset of some unit hypercube?