'3D bounding box for an item with three axis rotations

I'm trying to find the <x,y,z> size of what would end up being a bounding box for a rotated shape in all three axis rotations. Though to help keep it simple, the example demonstrated below has only the x axis rotated.

vector Size = <10,1,0.5>; vector Deg = <22.5,0,0>
if(Deg.x > 0 && Deg.y == 0 && Deg.z == 0){
  Y1 = Cos(Deg.x) * Size.y + Sin(Deg.x) * Size.z;
  Z1 = Cos(Deg.x) * Size.z + Sin(Deg.x) * Size.y;}

Below are for the y and z rotations, that is if you decided to change the degrees to say <0,22.5,0> and <0,0,22.5>.

if(Deg.y > 0 && Deg.x == 0 && Deg.z == 0){
  X2 = Cos(Deg.y) * Size.x + Sin(Deg.y) * Size.z;
  Z2 = Cos(Deg.y) * Size.z + Sin(Deg.y) * Size.x;}
if(Deg.z > 0 && Deg.x == 0 && Deg.y == 0){
  X3 = Cos(Deg.z) * Size.x + Sin(Deg.z) * Size.y;
  Y3 = Cos(Deg.z) * Size.y + Sin(Deg.z) * Size.x;}

Though the part I get lost at is, where do I go from here if when you have the rotation in two or three axis. Such as <22.5,22.5,0> or <22.5,22.5.22.5>

Is there a website with a tutorial or example equations I could review or are there any hints or ideas of what I could do to figure this out.

EDIT:

I do want to add that the comment from Nico helped, in that what I'm asking about is called: Axis-Aligned Bounding Box or AABB for short.

As for JohanC comment about the 22.5, yes the Deg = Degree. Also yes you'll have to turn the Degree into Radians, but I put it as Degree in the example for the Sin and Cos input to keep it simple.

If you're wondering how this question might be useful. Well as an example you'd need to know the AABB to help in an equation to keep the item in question flush with the surface its sitting on if you were to say resize the item while it had <x,y,z> rotations that weren't at perfect zero rotations.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source