The Gulf of Maine is a roughly rectangular depression with a surface area of around 36000 sqmi , enclosed to the west and north by the North American mainland and communicating with the Atlantic Ocean to the southeast.