Calculate capture rect in browser

This allows to save some network overhead (1 request vs 4 request per
element). Plus, it allows to do some preparations to screenshot capture
in future commits (i.e. scroll screenshot rect to be fully visible).