Well if you know the width, height, and starting coordinate of each rectangle then you can find the resized values as follows:
Say these are your variables
--------------------------------
totalWidth = (width of entire rectangle)
totalHeight = (height of entire rectangle)
totalWidthNew = (width to resize entire rectangle to)
totalHeightNew = (height to resize entire rectangle to)
width = (initial width of the Nth small rectangle)
height = (initial height of the Nth small rectangle)
x = (initial x coordinate of Nth small rectangle)
y = (initial y coordinate of Nth small rectangle)
Then you just recalculate width, height, x, and y by doing:
newWidth = (width / totalWidth) * totalWidthNew
newHeight = (height / totalHeight) * totalHeightNew
newX = (x / totalWidth) * totalWidthNew
newY = (y / totalHeight) * totalHeightNew
Just reassign width, height, x, and y for each of the current values of each small rectangle, and recalculate their newWidth, newHeight, newX, and newY values like above.
Please ask if anything is unclear.
NOTE: I just came up with all of this off the top of my head so I haven't tested it, but I am pretty confident it will work like you want.