In that case, you would change the "select" formula (from my first example, where I used the formula of an ellipse) to this:
Abs( :X coord - Round( :Cx ) ) <= 1 & Abs( :Y coord - Round( :Cy ) ) <= 1
The reason I say to use the ellipse example is that unlike with the rank-based example, center x and center y must be determined. Once you've done that, you're looking for a difference of -1, 0 or 1 from the rounded value of center x, and a difference of -1, 0 or 1 from the rounded value of center y.
In general, for an NxN square, you'd need the formula to look as above, but with (N-1)/2 substituted in each place where I have the value "1" in the formula above.
EDIT: actually, that is for an NxN square when N is odd. If N is even, you would need to do a bit more work.
a) if Cx or Cy turn out to be integers, you'd have to decide whether you want to grab more dice left of (analogously, below) center, or more dice right of (analogously, above) center, then move slightly off center and capture N/2 dice on each side of this. When Cx or Cy is not an integer, you can just capture N/2 dice on each side of Cx or Cy, respectively.