unity – Getting grid coordinates of cells bordering a square region

I would suggest you to just include those red cells in array, so it won’t be a problem to store them.

If you want to set bottom left cell exactly as (0, 0), you can something like this:

private Vector2Int greenCellsStartPoint;

public Vector2Int GetGreenCellOnGrid(Vector2Int position) // position from the bottom left cell
{
    return greenCellsStartPoint + position;
}

In this case you can store as many red cells as you want in array, this is doesn’t really a problem, position in Unity is relative.