EU nations have reached a deal on revising asylum rules, requiring countries to share hosting of asylum seekers or pay a financial contribution.