A vast archive of documents, unread since the sixteenth century, revises the portrait of Spain's best-known king