The sonnets are not as often the subject of Shakespeare and Film related material as we might expect. The BBC's A Waste of Shame (for which, q.v.) is the only full-length film treatment of the subject matter of the sonnets that I can think of. More often, sonnets are simply a way to call a certain flavor—usually a romantic flavor—into a film.
As is its wont, Star Trek does something weirder than that. In this case, some insane aliens have taken over the psychiatric ward. One of them recites a poem she wrote this morning (and then goes on with an old, old joke—you'll see):
Here's the sonnet in its entirety—I typed it up this morning!
Sonnet XVIIIShall I compare thee to a summer's day?
Thou art more lovely and more temperate:
Rough winds do shake the darling buds of May,
And summer's lease hath all too short a date:
Sometime too hot the eye of heaven shines,
And often is his gold complexion dimm'd;
And every fair from fair sometime declines,
By chance or nature's changing course untrimm'd;
But thy eternal summer shall not fade
Nor lose possession of that fair thou owest;
Nor shall Death brag thou wander'st in his shade,
When in eternal lines to time thou growest:
So long as men can breathe or eyes can see,
So long lives this and this gives life to thee.
Links: A Gateway to Star Trek Information at Wikipedia.