Profit Shifting and Trade Agreements in Imperfectly Competitive Markets