I have solved the problem with a simple function.
Ours unknowns are the rect's coordinates that we want to re-scale and its size, so if we denote with oldRectX and oldRectY, newRectX and newRectY rispectively as the old and the new rect's coordinates and with oldSVGWidth and oldSVGHeight, newSVGWidth and newSVGHeight rispectively as the old and the new SVG's dimensions that contains the rects, applying this ratio we can calculate the new positionament and the new size:
oldRectX : oldSVGWidth = newRectX : newSVGWidth
So I can calculate newRectX:
newRectX = (oldRectX * newSVGWidth)/oldSVGWith
The same reasoning it's apply for calculate newRectY with the difference that I have to replace the width with the height and X with Y:
newRectY = (oldRectY * newSVGHeight)/oldSVGHeight
Finally the new sizes:
newRectWidth = oldRectWidth * (newSVGWidth/oldSVGWidth)
newRectHeight = oldRectWidth * (newSVGHeight/oldSVGHeight)