Trying to create unit formations

Right now i’m just trying to create a basic box formation…I’ve been doing it the hard way like this:

void CreateBox(int i, int count)
{
    if (i == 1)
    {
        boxX = 0;
        boxY = 0;
    }
    else if (i == 2)
    {
        boxX = 1;
        boxY = 0;
    }
    else if (i == 3)
    {
        boxX = 0;
        boxY = 1;
    }
    else if (i == 4)
    {
        boxX = 1;
        boxY = 1;
    }
    else if (i == 5)
    {
        boxX = 2;
        boxY = 0;
    }
    else if (i == 6)
    {
        boxX = 2;
        boxY = 1;
    }
    else if (i == 7)
    {
        boxX = 2;
        boxY = 2;
    }
    else if (i == 8)
    {
        boxX = 0;
        boxY = 2;
    }
    else if (i == 9)
    {
        boxX = 1;
        boxY = 2;
    }
    else if (i == 10)
    {
        boxX = -1;
        boxY = 0;
    }
    else if (i == 11)
    {
        boxX = -2;
        boxY = 0;
    }
    else if (i == 12)
    {
        boxX = -1;
        boxY = -1;
    }
    else if (i == 13)
    {
        boxX = -2;
        boxY = -1;
    }
    else if (i == 14)
    {
        boxX = -2;
        boxY = -2;
    }
    pos = new Vector2(boxX, boxY);
}

What is a formula I can use to achieve the same thing? It is basically a box with points that need to be spaced out in each direction in 1 while stay centered at the point of origin 0,0;

int distance=1; //distance between the units
int i,j;
int unitsY=4,unitsX=4; //how many units on X and Y

    for(i=0;i<unitsY;i++)
    {
       for(j=0;j<unitsX;j++)
       {
          boxX = j*distance+originX;
          boxY = i*distance+originY;
       }
}

My approach would be:

    void CreateBox(int i)
        {
            var xList = new List<int>() { 0, 1, 0, 1, 2, 2, 2, 0, 1, -1, -2, -1, -2, -2 };
            var yList = new List<int>() { 0, 0, 1, 1, 0, 1, 2, 2, 2, 0, 0, -1, -1, -2 };
            pos = new Vector2(xList_, yList*);*_

}
Not sure what count is for.

The solutions provided are far worse on performance and are not answers to my question. I’m going to close this and have just finished doing it the long handed way which seems to be better for performance anyways because i’m not using a single “for” statement this way. for’s inside of for’s is not a good idea you never wanna do that.