A theory of repurchase agreements, collateral re-use, and repo intermediation