There are a few things that can be done to optimize this algorithm:
You can and should stop checking for collision the instant you find an axis where the rectangles don’t overlap. Remember, the separating axis theorem says that if two polygons are colliding all axes that are perpendicular to the edges of the polygons will show an overlap. Meaning that, if one axis shows no overlap, then collision is not possible and you should opt out to prevent unnecessary math.
It can really pay off to transform rectangle B into rectangle A’s local space. In order to do this, you should maintain these rectangles in local space and then transform rectangle B into world space and then by the inverse of rectangle A’s world space transform to put rectangle B into rectangle A’s local space. Then, translate both rectangles equally so that rectangle A is centered about the x and y axes. This means that two of the four axes that you need to project vectors onto are the unit (x and y) axes. Simply check for overlap between the x values of the corners of both rectangles and between the y values of the corners of both rectangles. With this solution you only have to actually project the vectors onto arbitrary axes twice, instead of four times.
Figure 8. Rectangles A and B in world space
Figure 9. Rectangles A and B Transformed Into A's Local Space
It can be wise to utilize a radius that completely encompasses the rectangle. If the distance between the centers of rectangles A and B is greater than the radius of A and B added together then there cannot possibly be a collision and it is unnecessary to use the separating axis theorem.