Use `getBoundingClientRect` to get element position and dimensions.

This is a revamped version of @nwah's PR #114.

Closes #114.
Fixes #79.
Fixes #119.
Fixes #149.
Fixes #166.
Fixes #167.