Each image is decoded, drawn onto a blank canvas and saved again in its original format. A canvas only holds pixels, so everything else that was in the file is left behind: EXIF (including GPS position, camera serial details and dates), XMP, IPTC captions and keywords, comments, embedded thumbnails and colour profiles.
Photos are drawn the way they display, so a phone picture that relied on an orientation tag is saved already upright.