I do not think that you could offset in the example you gave as the shares are being bought cum div and sold ex.
Years ago you could (pre automated settlements) and then the individual or his broker would have to make a div claim against the selling broker (of the buy order).