.size() only calculates the original size of an element, ignoring any css transforms like rotation or scaling. Unfortunately the result returned by .getBoundingClientRect() varies considerably. For example it works fine for scaled elements on their own, but rotated elements will give a box containing the entire area they cover.
It might be necessary to detect CSS scaling and use that to modify the calculated output.