[SOLVED] I'm failing at drawing multiple quads in a loop

Do you mean collision detection as TfGuy mentioned? Or do you want to detect mouse-over / clicks?

Most ghetto way to do the latter (though one that often works fine) is to do add a really simple function that checks whether the mouse is near the rectangle that you can add to your rect class:

int numQuads = 16;
Quad[] quads;

void setup()
{
  size(800, 600);

  // your list of quads
  quads = new Quad[numQuads];

  // assign attributes / initialize each quad with some values 
  // (ignore the below, you will do this in your own way)
  for (int i = 0; i < quads.length; i++)
  {
    // create a randomly rotated square (in a bit of a backward way) and add it to the random loc above
    quads[i] = new Quad();
    
    // pick a random location (x, y)
    PVector randomLoc = new PVector(random(width), random(height));

    float rotOffset = random(PI/2);
    float radius = 10;
    
    quads[i].centroid = randomLoc;
    quads[i].radius = radius;
    
    quads[i].a = PVector.add(randomLoc, new PVector(radius * cos(rotOffset + 0), radius * sin(rotOffset + 0)));
    quads[i].b = PVector.add(randomLoc, new PVector(radius * cos(rotOffset + 0.25 * TWO_PI), radius * sin(rotOffset + 0.25 * TWO_PI)));
    quads[i].c = PVector.add(randomLoc, new PVector(radius * cos(rotOffset + 0.5 * TWO_PI), radius * sin(rotOffset + 0.5 * TWO_PI)));
    quads[i].d = PVector.add(randomLoc, new PVector(radius * cos(rotOffset + 0.75 * TWO_PI), radius * sin(rotOffset + 0.75 * TWO_PI)));
  }
}

void draw()
{
  background(180);
  
  // render your quads
  for (int i = 0; i < quads.length; i++)
  {
    if(quads[i].isMouseOver())
      fill(255, 0, 0);
    else
      fill(255);
      
    stroke(0);
    quads[i].render();
  }
}

class Quad
{
  PVector a, b, c, d;

  PVector centroid;
  float radius;

  boolean isMouseOver()
  {
    if (dist(mouseX, mouseY, centroid.x, centroid.y) < radius)
      return true;
    else
      return false;
  }

  void render()
  {
    beginShape();
    vertex(a.x, a.y);
    vertex(b.x, b.y);
    vertex(c.x, c.y);
    vertex(d.x, d.y);
    endShape(CLOSE);
  }
}