Suppose I am given a non-negative function $f(x,y)$ defined for $x \in [0,1]$ and $y \in [0,1]$. I'd like to represent this function as a weighted sum $w_i$ of a small number of rectangular apertures. Thus letting $r_i(x,y) = 1$ if $(x, y)$ is in the rectangle $r_i$, and $= 0$ for points outside the rectangle $r_i$, we want
$f(x,y) ~= \sum_i w_i r_i(x,y)$.
Note this is a 2D version of this posting Decomposing a discrete signal into a sum of rectangle functions, and the rectangles are allowed to be at any orientation (which is not applicable to the 1D version, but I want to emphasize it).
Is there any nice way to do this aside from brute force search/minimization?