Refactors shared/pattern.js into core/ and display/

Needed for #3474

Prereq for shading types implementations to not increase size of the pdf.js