Repository: flutter
Issue: Text selection handles are missplaced on any rotated text
Labels: a: text input,framework,f: material design,has reproducible steps,P2,found in release: 3.10,found in release: 3.11,team-framework,triaged-framework

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

- add any kind of selection widget (for example a `SelectionArea`)
- add some widgets below that contains text
- you can see the text selection handles being correctly placed on any straight text
- you'll see the handles getting missplaced when this text is rotated

### Expected results

Handles are correctly placed, as the highlight is

### Actual results

The handles are missplaced

### Code sample

<details><summary>Code sample</summary>

```dart
void main() => runApp(const MaterialApp(home: Sample()));

class Sample extends StatelessWidget {
  const Sample({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SelectionArea(
        selectionControls: cupertinoTextSelectionControls,
        child: const Stack(
          children: [
            SampleTextBox('This is a normal text', position: Offset(100, 100), angle: 0),
            SampleTextBox('This is a rotated text', position: Offset(50, 200), angle: 20),
          ],
        ),
      ),
    );
  }
}

class SampleTextBox extends StatelessWidget {
  const SampleTextBox(
    this.text, {
    super.key,
    required this.position,
    required this.angle,
  });

  final String text;
  final Offset position;
  final double angle;

  @override
  Widget build(BuildContext context) {
    return Positioned(
      top: position.dy,
      left: position.dx,
      child: Transform.rotate(
        angle: angle,
        child: Container(
          color: Colors.green.withOpacity(0.5),
          padding: const EdgeInsets.all(8),
          child: Text(text, style: const TextStyle(color: Colors.white)),
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

![Screenshot 2023-05-26 at 13 26 54](https://github.com/flutter/flutter/assets/18635739/aaa95841-bf95-4019-be19-138da68adecb)
![Screenshot 2023-05-26 at 13 26 47](https://github.com/flutter/flutter/assets/18635739/a3be9518-84cb-4c63-899b-d26aa058ca31)
![Screenshot 2023-05-26 at 13 26 27](https://github.com/flutter/flutter/assets/18635739/e36fb814-7742-4e90-bdbc-82e3e0d26a4f)


### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.0.1 22A400 darwin-arm64, locale en-ES)
    • Flutter version 3.10.1 on channel stable at /Users/----/src/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (9 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/----/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/----/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] VS Code (version 1.79.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • iPhone de Carlos (mobile)           • ----            • ios            • iOS 16.4.1 20E252
    • iPhone SE (3rd generation) (mobile) • ---- • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4
      (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 13.0.1 22A400 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>