But if I already have the bounding box, why do I need to loop through all the vertices still?
I should already be able to get the center of the bounding box.
If there is already a bounding box there is no need to loop through the vertices to calculate one; in the OP that was not clear.
Using the bounding box, calculated a center point from it.
Then inverse that point and put it into a translation matrix. If your point is (3, 7, -2) then the inverse is (-3, -7, 2).
it rotates funny, not at the centroid of the object.
In local space: Translate your geometry using the inverse center point's translation matrix
then
In world space: Rotate your object first, and then translate by (10, 5, 0)
According to my API
API you are making or existing engine?