Singapore and Malaysia have agreed to swap land parcels in the city-state as part of a broad agreement that will see Malaysia give up its control of railway land that runs through Singapore.